$(function() {
	$('#vue_vm_list div').hide();
});

var bedRetain = {
	bedRetainId: '',
	elderId: '',
	bedId: '',
	retainStartTime: '',
	retainEndTime: '',
	retainStatus: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	subjectRoomId: getLoginedUser().subjectRoomId,
	subjectRoomName: getLoginedUser().subjectRoomName
};

var view = {
	data: bedRetain
};

if($('#vue_vm').length > 0) {
	var vue_vm = new Vue({
		el: '#vue_vm',
		data: view
	});
}

function bedRetain_save() {
	bedRetain.elderId = elderBeHospital.elderForm.elderId;
	bedRetain.elderName = elderBeHospital.elderForm.name;
	bedRetain.beHospitalId = elderBeHospital.beHospitalId;
	bedRetain.bedId = elderBeHospital.bedId;
	// bedRetain.retainStartTime = getStandardDay($('#startYear').val(), $('#startMonth').val(), $('#startDay').val());
	// bedRetain.retainEndTime = getStandardDay($('#endYear').val(), $('#endMonth').val(), $('#endDay').val());
	bedRetain.retainStatus = 1;

	save_basic(path+'/bedRetain/save', {bedRetain:bedRetain}, function() {
		alert('保存成功');
		var pageParam = bedRetain;
		pageParam.subjectRoomName = getLoginedUser()? getLoginedUser().subjectRoomName: '';
		pageParam.createName = getLoginedUser()? getLoginedUser().staffName: '';
		window.open('6-2-3blchuanwei-1.html?pageParam='+encodeURIComponent(JSON.stringify(pageParam)));
	});
}

function findBySubjectRoomId(subjectRoomId) {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	find_basic_by_json(path+'/bedRetain/findAll', {subjectRoomId: subjectRoomId}, function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/bedRetain/deleteBatch');
}
